package com.flute.icrawler.config;

import java.io.Serializable;
import java.util.List;

public class Policy implements Serializable, Comparable<Policy> {
	private int scheduler;
	private int granularity;
	private List<AdjustPolicy> adjustpolicys;

	public List<AdjustPolicy> getAdjustpolicys() {
		return adjustpolicys;
	}

	public void setAdjustpolicys(List<AdjustPolicy> adjustpolicys) {
		this.adjustpolicys = adjustpolicys;
	}

	public int getGranularity() {
		return granularity;
	}

	public void setGranularity(int granularity) {
		this.granularity = granularity;
	}

	public int getScheduler() {
		return scheduler;
	}

	public void setScheduler(int scheduler) {
		this.scheduler = scheduler;
	}

	@Override
	public int compareTo(Policy o) {
		if (o.getGranularity() == 0 || o.getGranularity() > this.granularity) {
			return -1;
		} else if (o.getGranularity() < this.granularity) {
			return 1;
		} else {
			return 0;
		}
	}

}
